-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle DefPath hashing centrally as part of DefPathTable (+ save work during SVH calculation) #41056
Merged
bors
merged 2 commits into
rust-lang:master
from
michaelwoerister:central-defpath-hashes
Apr 7, 2017
Merged
Handle DefPath hashing centrally as part of DefPathTable (+ save work during SVH calculation) #41056
bors
merged 2 commits into
rust-lang:master
from
michaelwoerister:central-defpath-hashes
Apr 7, 2017
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nikomatsakis
approved these changes
Apr 4, 2017
r=me after rebase |
The SVH (Strict Version Hash) of a crate is currently computed by hashing the ICHes (Incremental Computation Hashes) of the crate's HIR. This is fine, expect that for incr. comp. we compute two ICH values for each HIR item, one for the complete item and one that just includes the item's interface. The two hashes are are needed for dependency tracking but if we are compiling non-incrementally and just need the ICH values for the SVH, one of them is enough, giving us the opportunity to save some work in this case.
michaelwoerister
force-pushed
the
central-defpath-hashes
branch
from
April 7, 2017 12:47
cbc74ff
to
bb63872
Compare
@bors r=nikomatsakis |
📌 Commit bb63872 has been approved by |
frewsxcv
added a commit
to frewsxcv/rust
that referenced
this pull request
Apr 7, 2017
…shes, r=nikomatsakis Handle DefPath hashing centrally as part of DefPathTable (+ save work during SVH calculation) In almost all cases where we construct a `DefPath`, we just hash it and throw it away again immediately. With this PR, the compiler will immediately compute and store the hash for each `DefPath` as it is allocated. This way we + can get rid of any subsequent `DefPath` hash caching (e.g. the `DefPathHashes`), + don't need to allocate a transient `Vec` for holding the `DefPath` (although I'm always surprised how little these small, dynamic allocations seem to hurt performance), and + we don't hash `DefPath` prefixes over and over again. That last part is because we construct the hash for `prefix::foo` by hashing `(hash(prefix), foo)` instead of hashing every component of prefix. The last commit of this PR is pretty neat, I think: ``` The SVH (Strict Version Hash) of a crate is currently computed by hashing the ICHes (Incremental Computation Hashes) of the crate's HIR. This is fine, expect that for incr. comp. we compute two ICH values for each HIR item, one for the complete item and one that just includes the item's interface. The two hashes are are needed for dependency tracking but if we are compiling non-incrementally and just need the ICH values for the SVH, one of them is enough, giving us the opportunity to save some work in this case. ``` r? @nikomatsakis This PR depends on rust-lang#40878 to be merged first (you can ignore the first commit for reviewing, that's just rust-lang#40878).
bors
added a commit
that referenced
this pull request
Apr 7, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In almost all cases where we construct a
DefPath
, we just hash it and throw it away again immediately.With this PR, the compiler will immediately compute and store the hash for each
DefPath
as it is allocated. This way weDefPath
hash caching (e.g. theDefPathHashes
),Vec
for holding theDefPath
(although I'm always surprised how little these small, dynamic allocations seem to hurt performance), andDefPath
prefixes over and over again.That last part is because we construct the hash for
prefix::foo
by hashing(hash(prefix), foo)
instead of hashing every component of prefix.The last commit of this PR is pretty neat, I think:
r? @nikomatsakis
This PR depends on #40878 to be merged first (you can ignore the first commit for reviewing, that's just #40878).